<template>
	<view class="container">
		<view v-if="list.length===0">
			<luanqing-empty :show="true" text="没有更多数据啦" textColor="#000"></luanqing-empty>
		</view>
		<scroll-view scroll-y="true" v-if="list.length>0">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="date">
					{{item.createtime}}
				</view>
				<navigator class="info" 
				:url="'./detail?id='+item.rec_id"
				hover-class="none">
					<view class="title">
						{{item.message_title}}
					</view>
					<view class="content">
						<rich-text :nodes="item.message_content"></rich-text>
					</view>
					<view class="is_see" v-if="item.is_see===0"></view>
				</navigator>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				token:'',
				list:[],
			}
		},
		onShow() {
			uni.showLoading({
				title: "加载中...",
				mask: true
			})
			uni.getStorage({
				key: 'user_info',
				success: (res) => {
					this.token = res.data.token;
					this.getList()
				},
				fail: (res) => {
					uni.redirectTo({
						url: '../../login/auth'
					});
				}
			});
		},
		methods:{
			getList(){
				this.$request('/api/wxapp/v2/mine/notice/list',{
					"token": this.token,
				}).then(res => {
					uni.hideLoading();
					if (res.code == 1) {
						this.list = res.data;
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container{
		height: 100%;
		background: #F6F6F6;
	}
	.item{
		margin-top: 40rpx;
		.date{
			font-size: 15px;
			color: #333333;
			height: 23px;
			line-height: 23px;
			text-align: center;
		}
	}
	.info{
		width: 670rpx;
		max-height: 200rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		margin: 7px auto 0 auto;
		padding: 40rpx 20rpx;
		box-sizing: border-box;
		overflow: hidden;
		position: relative;
		.title{
			font-size: 15px;
			color: #333333;
		}
		.content{
			margin-top: 7px;
		}
		.is_see{
			position: absolute;
			top: 24rpx;
			right: 26rpx;
			width: 12px;
			height: 12px;
			border-radius: 50%;
			background-color: #E02020;
		}
	}
</style>
